minecraftmodcustomstufffandomcom-20200215-history
Torch
Torches are a block type available in Custom Stuff. As one might expect, this block type mimics the two types of torches that already exist in vanilla Minecraft, at least in so far as their geometry and placement goes. There is presently no way to make a torch emit a Redstone signal (as a vanilla redstone torch does), but light can be emitted using the light attribute. Torches take up a single block and must be placed either on top of or on the side of a full block (either normal or simple block type). Their geometry consists of four planes that intersect near the middle, creating the illusion of a solid shaft when the center 2x2 pixels are opaque. This makes them both challenging and simple to texture. Because torches use their damage values to remember their orientation when placed, you cannot use these values to create variations. Redstone Powered Torch (CS2 0.10.0 and above) mod.js config.addBlockIdProperty("cobaltElecTorchID", 2521); config.addBlockIdProperty("cobaltElecTorchOnID", 2522); mod.addBlock("cobaltElecTorch.js", "torch"); mod.addBlock("cobaltElecTorchOn.js", "torch"); blocks/cobaltElecTorch.js id = config.getBlockId("cobaltElecTorchID"); name = "cobaltElecTorch"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; displayName0 = "Electric Cobalt Torch"; canPlaceOnCeiling0 = false; canPlaceOnFloor0 = true; canPlaceOnWall0 = true; hardness0 = 5; resistance0 = 30; toolClass0 = "pickaxe"; harvestLevel0 = 2; textureFileXP0 = "cobaltTorchOff.png"; textureFileXN0 = "cobaltTorchOff.png"; textureFileYP0 = "cobaltTorchOff.png"; textureFileYN0 = "cobaltTorchOff.png"; textureFileZP0 = "cobaltTorchOff.png"; textureFileZN0 = "cobaltTorchOff.png"; addToCreative0 = true; onRedstoneSignal0 = "if(redstoneSignal true){world.setBlockIdAndMetadata(position, config.getBlockId('cobaltElecTorchOnID'), world.getBlockMetadata(position));}"; blocks/cobaltElecTorchOn.js id = config.getBlockId("cobaltElecTorchOnID"); name = "cobaltElecTorchOn"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; displayName0 = "Electric Cobalt Torch"; canPlaceOnCeiling0 = false; canPlaceOnFloor0 = true; canPlaceOnWall0 = true; drop0 = config.getBlockId("cobaltElecTorchID") + ":0 1"; pick0 = config.getBlockId("cobaltElecTorchID") + ":0 1"; light0 = 15; hardness0 = 5; resistance0 = 30; toolClass0 = "pickaxe"; harvestLevel0 = 2; textureFileXP0 = "cobaltTorchOn.png"; textureFileXN0 = "cobaltTorchOn.png"; textureFileYP0 = "cobaltTorchOn.png"; textureFileYN0 = "cobaltTorchOn.png"; textureFileZP0 = "cobaltTorchOn.png"; textureFileZN0 = "cobaltTorchOn.png"; addToCreative0 = false; onRedstoneSignal0 = "if(redstoneSignal false){world.setBlockIdAndMetadata(position, config.getBlockId('cobaltElecTorchID'), world.getBlockMetadata(position));}"; Torch Block Attributes Required Attributes * displayName * id * name * textureFileXN * textureFileXP * textureFileYN * textureFileYP * textureFileZN * textureFileZP Optional Attributes * addToCreative * canPlaceOnCeiling * canPlaceOnFloor * canPlaceOnWall * canSilkHarvest * creativeTab * drop * fireSpreadSpeed * flammability * fortuneModifier * hardness * harvestLevel * hasCollision * hasTileEntity * isBeaconBase * isBurning * isFireSource * isWood * light * material * opacity * pick * resistance * semiTransparent * slipperiness * stepSound * tickrate * tileEntity * tileTransparent * toolClass * transparent textureFile and textureIndex In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes. light This attribute is what makes your torch give off light. It is set to 0 by default, so make sure to set this value if you want your torch to do more than look good. Example Torch Block (CS1) name="Faerie Light"; id=128; texturefile="CustomStuff.png"; textureindex=2; type="torch"; material="wood"; stepsound="wood"; hardness=0; hardness1=0; hardness2=0; hardness3=0; hardness4=0; hardness5=0; resistance=0; harvestlevel=0; toolclass="pickaxe, axe, shovel, hoe"; iddropped=128; damagedropped=0; quantitydropped=1; opacity=0; light=14; collision="false"; addtocreative="true"; Torch Block Attributes (CS1) Below is a table of attributes available to torch-type blocks, including information on notable attributes. Keep in mind that for some attributes that can be altered with damage values, you must specify that attribute for the first six DVs (0-5) for it to function in all orientations of the torch. This does not seem to apply to all attributes, however. Light, for example, works fine with only the basic value specified while hardness does not. Required Attributes * name * id * type * texturefile * textureindex * harvestlevel * toolclass Optional Attributes * material * stepsound * hardness * resistance * light * iddropped * quantitydropped * damagedropped * opacity * collision * speed * gravity * movebypiston * addtocreative * color * container type This must be set to 'torch' in order for the block to function as a torch. opacity If your torch emits a strong light, there's no reason to set this. Otherwise, this attribute should be set to a low value (preferably 0) to avoid it casting a false shadow. collision Although somewhat counter-intuitive, this attribute has to be set in order to prevent torches from remaining solid. Keeping this attribute at 'false' will enforce collision with the torch geometry (which is small enough that you can fit between two torches placed side-by-side) and allow you to stand on top of them. Leaving this as true (default) will also allow them to be successfully moved by pistons unless movebypiston is set to false. light As silly as it may seem, torches need not emit light unless the light attribute is set for the torch. Limitations *There is presently no way to override the default behavior of torches, and allow them to be placed in midair or on ceilings. *There is presently no way to set up a torch that emits a redstone signal like a redstone torch does. Bugs * Torches do not seem to drop anything, even when broken with the proper tool. *Likewise, event triggers do not seem to work when placed on torches. *Some attributes, like Hardness require that it be specified for all of the first five damage values in order to work. This behavior was previously fixed in fence gates, stairs, ladders and upper part of door. *Unlike vanilla torches, Custom Torches are not swept away or destroyed when placed in water or lava. **This can be artifically changed by adding a few lines to the block file and adding a script file. Lines starting with // are only to tell where to put the text, please do not copy them into the files. Note: script only checks for water and lava, check the bucket workaround or manually add extra checks to the if statement... //for the torch's .block file tickrate = 20; update = "customstuff.loadScript('floodcheck.script');"; //for the floodcheck.script file var checkedBlockId; for(var sideCheck = 0;sideCheck < 6;sideCheck++) { switch(sideCheck) { case 0: origin.y--; checkedBlockId = world.getBlockId(origin); origin.y++; break; case 1: origin.y++; checkedBlockId = world.getBlockId(origin); origin.y--; break; case 2: origin.z--; checkedBlockId = world.getBlockId(origin); origin.z++; break; case 3: origin.z++; checkedBlockId = world.getBlockId(origin); origin.z--; break; case 4: origin.x--; checkedBlockId = world.getBlockId(origin); origin.x++; break; case 5: origin.x++; checkedBlockId = world.getBlockId(origin); origin.x--; break; } if(checkedBlockId 9 || checkedBlockId 8 || checkedBlockId 10 || checkedBlockId 11) { world.harvestBlock(origin); break; } } Category:Block Types Category:Examples Category:Custom Stuff 2 Category:Examples (CS2) Category:Examples (CS1)